//
//  FindTableViewCell.m
//  半糖
//
//  Created by RenShuang on 15-9-11.
//  Copyright (c) 2015年 shuang. All rights reserved.
//

#import "FindTableViewCell.h"


@implementation FindTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.userImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 35, 35)];
        _userImageView.layer.masksToBounds = YES;
        _userImageView.layer.cornerRadius = 17.5;
        //_userImageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_userImageView];
        [_userImageView release];
        
        self.userLabel = [[UILabel alloc] initWithFrame:CGRectMake(45, 10, 200, 15)];
        _userLabel.font = [UIFont systemFontOfSize:15.];
        [self.contentView addSubview:_userLabel];
        [_userLabel release];
        
        self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(45, 25, 100, 15)];
        [self.contentView addSubview:_timeLabel];
        _timeLabel.font = [UIFont systemFontOfSize:15.];
        [_timeLabel release];
        
        self.picImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 50, SCREEN_WIDTH, SCREEN_WIDTH)];
        [self.contentView addSubview:_picImageView];
        [_picImageView release];
        
        self.contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 55+SCREEN_WIDTH, SCREEN_WIDTH-20, 60)];
        _contentLabel.numberOfLines = 0;
       // _contentLabel.backgroundColor = [UIColor redColor];
        _contentLabel.font = [UIFont systemFontOfSize:15.];
        [self.contentView addSubview:_contentLabel];
        [_contentLabel release];
        
        _penImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, SCREEN_WIDTH+125, 15, 15)];
        _penImageView.image = [UIImage imageNamed:@"qianbi.png"];
        [self.contentView addSubview:_penImageView];
        [_penImageView release];
        
        _typeLabel = [[UILabel alloc] initWithFrame:CGRectMake(45, SCREEN_WIDTH+125, 300, 15)];
        //_typeLabel.backgroundColor = [UIColor redColor];
        _typeLabel.textColor = [UIColor redColor];
        _typeLabel.font = [UIFont systemFontOfSize:13.];
        [self.contentView addSubview:_typeLabel];
        [_typeLabel release];
        
        
//        _shareButton = [UIButton buttonWithType:UIButtonTypeSystem];
//        _shareButton.frame = CGRectMake(0, SCREEN_WIDTH+161, SCREEN_WIDTH/3, SCREEN_WIDTH*11/20-171);
//        [_shareButton setTitle:@"分享" forState:UIControlStateNormal];
//        [self.contentView addSubview:_shareButton];
//        
//        
//        _commentButton = [UIButton buttonWithType:UIButtonTypeSystem];
//        _commentButton.frame = CGRectMake(SCREEN_WIDTH/3, SCREEN_WIDTH+161, SCREEN_WIDTH/3, SCREEN_WIDTH*11/20-171);
//        [_commentButton setTitle:@"评论" forState:UIControlStateNormal];
//        [self.contentView addSubview:_commentButton];
//        
//        _likeButton = [UIButton buttonWithType:UIButtonTypeSystem];
//        _likeButton.frame= CGRectMake(SCREEN_WIDTH*2/3, SCREEN_WIDTH+161, SCREEN_WIDTH/3, SCREEN_WIDTH*11/20-171);
//        [_likeButton setTitle:@"❤️" forState:UIControlStateNormal];
//        [self.contentView addSubview:_likeButton];
        
//        self.contentView.backgroundColor = [UIColor colorWithRed:245/255. green:245/255. blue:245/255. alpha:1];
    }
    return self;
}

- (void)getCell:(FindTableModel *)model
{
    [_userImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar]];
    _userLabel.text = model.username;
    _timeLabel.text = model.datestr;
    [_picImageView sd_setImageWithURL:[NSURL URLWithString:model.url]placeholderImage:[UIImage imageNamed:@"占位图.png"]];
  //  NSLog(@"图片%@",model.url);
    _contentLabel.text = model.content;
    NSString *typeStr = [model.i_tags stringByReplacingOccurrencesOfString:@"," withString:@"      "];
    self.typeLabel.text = typeStr;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
